import React, { useState, useEffect, useRef } from 'react';

import A from './components/a.js'
export default function(props){
  const [state, setState] = useState()
  const aEle = useRef(null)
  
  const clickA = () => {
      console.log("A 打印", aEle)
     let add = aEle.current.add()  //  父组件 拿到 子组件 返回的值
     console.log("add", add)
  }

  return (
    <div>
        函数 父组件
        <button onClick={clickA} > 父调子方法 </button>
        <hr />
        <A  ref={aEle} />
    </div>
  )
}